package com.yf.exam.modules.cert.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yf.exam.core.api.dto.PagingReqDTO;
import com.yf.exam.core.utils.BeanMapper;
import com.yf.exam.modules.cert.dto.CertDTO;
import com.yf.exam.modules.cert.dto.request.CertReqDTO;
import com.yf.exam.modules.cert.dto.response.CertRespDTO;
import com.yf.exam.modules.cert.entity.Cert;
import com.yf.exam.modules.cert.mapper.CertMapper;
import com.yf.exam.modules.cert.service.CertService;
import org.springframework.stereotype.Service;

/**
* <p>
* 语言设置 服务实现类
* </p>
*
* @author 聪明笨狗
* @since 2020-05-25 13:23
*/
@Service
public class CertServiceImpl extends ServiceImpl<CertMapper, Cert> implements CertService {

    @Override
    public IPage<CertRespDTO> paging(PagingReqDTO<CertReqDTO> reqDTO) {
        return baseMapper.paging(reqDTO.toPage(), reqDTO.getParams());
     }

    @Override
    public void save(CertDTO reqDTO) {

        //复制参数
        Cert entity = new Cert();
        BeanMapper.copy(reqDTO, entity);
        this.saveOrUpdate(entity);
    }
}
